
<template >
  <el-form  ref="loginRefForm" :model="userDetail" label-width="120px" >
    <el-form-item label="ID">&nbsp
      <div class="detail">{{userDetail.id}}</div>
    </el-form-item>
    <el-form-item label="账号" >&nbsp
      <div class="detail">{{userDetail.loginAct}}</div>
    </el-form-item>
    <el-form-item label="密码" >&nbsp
      <div class="detail">******</div>
    </el-form-item>
    <el-form-item label="姓名" >&nbsp
      <div class="detail">{{userDetail.name}}</div>
    </el-form-item>
    <el-form-item label="手机" >&nbsp
      <div class="detail">{{userDetail.phone}}</div>
    </el-form-item>
    <el-form-item label="邮箱" >&nbsp
      <div class="detail">{{userDetail.email}}</div>
    </el-form-item>
    <el-form-item label="账号未过期" >
      <div class="detail">&nbsp
        {{userDetail.accountNoExpired ===1 ?'是':'否'}}
      </div>
    </el-form-item>
    <el-form-item label="密码未过期" >
      <div class="detail">&nbsp
        {{userDetail.credentialsNoExpired ===1 ?'是':'否'}}
      </div>
    </el-form-item>
    <el-form-item label="账号未锁定" >
      <div class="detail">&nbsp
        {{userDetail.accountNoLocked ===1 ?'是':'否'}}
      </div>
    </el-form-item>
    <el-form-item label="账号是否启用" >
      <div class="detail">&nbsp
        {{userDetail.accountEnabled ===1 ?'是':'否'}}
      </div>
    </el-form-item>
    <el-form-item label="创建时间" >
      <div class="detail">&nbsp{{userDetail.createTime}}</div>
    </el-form-item>
    <el-form-item label="创建人" >
      <div class="detail">&nbsp{{userDetail.createByDO.name}}</div>
    </el-form-item>
    <el-form-item label="编辑时间" >
      <div class="detail">&nbsp{{userDetail.editTime}}</div>
    </el-form-item>
    <el-form-item label="编辑人" >
      <div class="detail">&nbsp{{userDetail.editByDO.name}}</div>
    </el-form-item>
    <el-form-item label="最近登录时间" >
      <div class="detail">&nbsp{{userDetail.lastLoginTime}}</div>
    </el-form-item>
    <el-form-item >
      <el-button type="success" @click="goBack()">返 回</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
import {doGet} from "../http/httpRequest.js";
import {goBack} from "../util/Util.js";

export default {
  name: "UserDetailView",
  data() {
    return{
      //用户详情对象，初始值是空
      userDetail :{//包含两个对象-创建人对象和编辑人对象
       createByDO:{},
       editByDO:{}
      }
    }
  },
  mounted() {
    this.loadUserDetail();
  },
  methods:{
    goBack,
    //加载用户详情信息
    loadUserDetail(){
      let id=this.$route.params.id;//此处id要和route.js文件里的path:'user/:id'相同
      doGet("/api/user/"+id,{}).then(resp=>{
        if(resp.data.code===200){
          this.userDetail=resp.data.data;
          if(!this.userDetail.createByDO){
            this.userDetail.createByDO={};
          }
          if(!this.userDetail.editByDO){
            this.userDetail.editByDO={};
          }
        }
      })
    },
  }
}
</script>


<style scoped>
.detail{
  background-color: #f9f9f9;
   width:100%;
  padding-left:15px;
}
</style>
